<%@ page import="com.sbdcpn.business.wzmis.base.CodeCheck,java.util.Map" %>
<%
   int num=0;
   String code=request.getParameter("matcode");
   System.out.println("code is:"+code);
   CodeCheck mat=new CodeCheck();
   num=mat.getNum(code);
   Map matRs=null;
%>
<html>
<head>
<title>set Material code</title>
</head>
<%if(num==0){%>
  <body onLoad="return setCode()">
  <SCRIPT LANGUAGE="JavaScript">
   <!--
    function setCode(){
		 alert("System has no this code ,please repead or select!");
		 window.close();
	}
   -->
  </SCRIPT>
<%}if(num==1){%>
	<body onLoad="return setCode('<%=code%>')">
	<SCRIPT LANGUAGE="JavaScript">
	<!--
		function setCode(acode){
	       var code=acode;
		   if(confirm("Do you sure set "+code+" and about it?")){
			 <%matRs=mat.getMaterial(code);
			   System.out.println("map is:"+matRs);
		     %>
		     var name='<%=(String)matRs.get("material_name")%>';
		     window.parent.document.all("plan_req_material.material_name").value=name;
		     alert(name);
			 window.close();
		   }else{
			 return;
			 window.close();
		   }
		}
	-->
	</SCRIPT>
<%}if(num>1){%>
	<body onLoad="return setCode()">
	<SCRIPT LANGUAGE="JavaScript">
	<!--
		function setCode(){
		   alert("Error:This code is more!");
		   window.close();
		}
	-->
	</SCRIPT>
<%}%>
<b>aaaa</b>
</body>
</html>
